/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.openbravo.pos.payment;

import com.openbravo.bean.PaymentInfo;
import com.openbravo.pos.bean.PaymentInfoTicket;
import java.awt.Component;
import java.awt.ComponentOrientation;
import java.awt.Dialog;
import java.awt.Frame;
import java.awt.Window;

/**
 *
 * @author Administrator
 */
public class JPaymentSelectOrderFundOut extends JPaymentSelect{
   
        /** Creates new form JPaymentKeyBoardSelect */
    protected JPaymentSelectOrderFundOut(java.awt.Frame parent, boolean modal, ComponentOrientation o) {
        super(parent, modal, o);
    }
    /** Creates new form JPaymentKeyBoardSelect */
    protected JPaymentSelectOrderFundOut(java.awt.Dialog parent, boolean modal, ComponentOrientation o) {
        super(parent, modal, o);
    }

    public static JPaymentSelect getDialog(Component parent) {

        Window window = getWindow(parent);

        if (window instanceof Frame) {
            return new JPaymentSelectOrderFundOut((Frame) window, true, parent.getComponentOrientation());
        } else {
            return new JPaymentSelectOrderFundOut((Dialog) window, true, parent.getComponentOrientation());
        }
    }

    protected void addTabs() {

        addTabPayment(new JPaymentSelect.JPaymentCashRefundCreator());
        addTabPayment(new JPaymentSelect.JPaymentChequeRefundCreator());
        addTabPayment(new JPaymentSelect.JPaymentPaperRefundCreator());
        addTabPayment(new JPaymentSelect.JPaymentMagcardRefundCreator());
        addTabPayment(new JPaymentSelect.JPaymentDebtRefundCreator());
        setHeaderVisible(false);
    }

    public void setStatusPanel(boolean isPositive, boolean isComplete) {

        setAddEnabled(isPositive && !isComplete);
        setOKEnabled(isComplete);
    }

    public PaymentInfo getDefaultPayment(double total) {
        return new PaymentInfoTicket(total, "cashrefund");
    }

}
